import 'dart:async';

class DebounceUtils {
  static const durationTime = 1000;
  static Timer? timer;

  static debounce(Function doSomething, {durationTime = durationTime}) {
    timer?.cancel();
    timer = new Timer(Duration(milliseconds: durationTime), () {
      doSomething.call();
      timer = null;
    });
  }
}
